a = 5
b = 6
print("a+b=",a+b,'\n',"a-b=",a-b,"\n","a*b=",a*b,'\n',"a/b=",a/b,'\n',"a**b=a^b=",a**b,'\n',"a%b=",a%b,sep='')
#将每个公式都带入一个print运算，用\n换行，sep消除间隔
#以上为输入两个整数，计算他们+，-，* / 和求余的结果
print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")#只是间隔
four_number = 1234  #给一个变量为四位整数
str_four_number = str(four_number)  #转换为字符串以取得每位数字
number1 = str_four_number[0]
number2 = str_four_number[1]
number3 = str_four_number[2]
number4 = str_four_number[3]
#给每个数字一个变量，此时都为字符串
number_sum = int(number1)+int(number2)+int(number3)+int(number4)    #相加的同时改变字符串为整数
print(number_sum)
#以上为输入一个四位数，计算他们各位上的数字和
print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")#只是间隔
ord1 = ord('宛') #ord函数基本运用
print(ord1)
#以上为输入一个字符，输出其对应的ASCII码值
print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")#只是间隔
c = 1.1
d = 1.2
cd1 = c + d
cd2 = c - d
cd3 = c * d
cd4 = c / d
print('c+d=',cd1,'\n','c-d=',cd2,'\n','c*d=',cd3,'\n','c/d=',cd4,sep='')    #同第一题，但这次将大部分先以变量作为中转运算
#以上为输入两个浮点数，计算他们加减乘除的结果。
print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")#只是间隔
in_length = input('请输入英尺以换算为厘米：')    #输入英尺
cm_length = 2.54*float(in_length)   #输出厘米，顺便进行换算
print(in_length,'英寸等于',cm_length,'厘米',sep='')
#以上为厘米英寸转换
print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")#只是间隔
Kg = input('请输入千克以换算为磅：')
P = 0.4535924*float(Kg)
print(Kg,'千克为',P,'磅',sep='')
#同第5题
#以上为千克磅转换
print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")#只是间隔
chr_number = input('请输入数字以转换为字符：')
word = chr(int(chr_number))#转换输入数字从字符串为整数，最后用chr函数转换为字符
print(word)
#以上为chr转换
